import { IPSModelSortable } from '../../ipsmodel-sortable';
import { IPSAppDEPrint } from '../../app/dataentity/ipsapp-deprint';
import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEAction } from '../action/ipsdeaction';
import { IPSDEDataSet } from '../ds/ipsdedata-set';
import { IPSDEPrint } from './ipsdeprint';
import { IPSDEOPPriv } from '../priv/ipsdeoppriv';
import { IPSSysSFPlugin } from '../../res/ipssys-sfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEPrintImpl extends PSModelObjectImpl implements IPSDEPrint, IPSAppDEPrint, IPSModelSortable {
  get codeName(): string {
    return this.M.codeName;
  }

  get dataAccessAction(): string {
    return this.M.dataAccessAction;
  }

  protected detailpsde: IPSDataEntity | null = null;

  getDetailPSDE(): IPSDataEntity | null {
    if (this.detailpsde != null) return this.detailpsde;
    const value = this.M.getDetailPSDE;
    if (value == null) {
      return null;
    }
    this.detailpsde = this.getPSModel4('dataentity.IPSDataEntity', value, 'getDetailPSDE') as IPSDataEntity;
    return this.detailpsde;
  }

  get detailPSDE(): IPSDataEntity | null {
    return this.getDetailPSDE();
  }

  getDetailPSDEMust(): IPSDataEntity {
    const value = this.getDetailPSDE();
    if (value == null) {
      throw new Error('未指定明细数据实体对象');
    }
    return value;
  }

  protected detailpsdedataset: IPSDEDataSet | null = null;

  getDetailPSDEDataSet(): IPSDEDataSet | null {
    if (this.detailpsdedataset != null) return this.detailpsdedataset;
    const value = this.M.getDetailPSDEDataSet;
    if (value == null) {
      return null;
    }
    this.detailpsdedataset = this.getDetailPSDEMust().findPSDEDataSet(value);
    return this.detailpsdedataset;
  }

  get detailPSDEDataSet(): IPSDEDataSet | null {
    return this.getDetailPSDEDataSet();
  }

  getDetailPSDEDataSetMust(): IPSDEDataSet {
    const value = this.getDetailPSDEDataSet();
    if (value == null) {
      throw new Error('未指定明细数据实体数据集对象');
    }
    return value;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  protected getdatapsdeaction: IPSDEAction | null = null;

  getGetDataPSDEAction(): IPSDEAction | null {
    if (this.getdatapsdeaction != null) return this.getdatapsdeaction;
    const value = this.M.getGetDataPSDEAction;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.getdatapsdeaction = ipsdataentity.findPSDEAction(value);
    }
    return this.getdatapsdeaction;
  }

  get getDataPSDEAction(): IPSDEAction | null {
    return this.getGetDataPSDEAction();
  }

  getGetDataPSDEActionMust(): IPSDEAction {
    const value = this.getGetDataPSDEAction();
    if (value == null) {
      throw new Error('未指定获取数据实体行为');
    }
    return value;
  }

  protected getdatapsdeoppriv: IPSDEOPPriv | null = null;

  getGetDataPSDEOPPriv(): IPSDEOPPriv | null {
    if (this.getdatapsdeoppriv != null) return this.getdatapsdeoppriv;
    const value = this.M.getGetDataPSDEOPPriv;
    if (value == null) {
      return null;
    }
    this.getdatapsdeoppriv = this.getPSModel4('dataentity.priv.IPSDEOPPriv', value, 'getGetDataPSDEOPPriv') as IPSDEOPPriv;
    return this.getdatapsdeoppriv;
  }

  get getDataPSDEOPPriv(): IPSDEOPPriv | null {
    return this.getGetDataPSDEOPPriv();
  }

  getGetDataPSDEOPPrivMust(): IPSDEOPPriv {
    const value = this.getGetDataPSDEOPPriv();
    if (value == null) {
      throw new Error('未指定获取数据实体操作标识');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  get pOTime(): number {
    return this.M.pOTime != null ? this.M.pOTime : -1;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后台扩展插件');
    }
    return value;
  }

  get reportFile(): string {
    return this.M.reportFile;
  }

  get reportModel(): string {
    return this.M.reportModel;
  }

  get reportType(): string {
    return this.M.reportType;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get defaultMode(): boolean {
    return this.M.defaultMode != null ? this.M.defaultMode : false;
  }

  get enableColPriv(): boolean {
    return this.M.enableColPriv != null ? this.M.enableColPriv : false;
  }

  get enableLog(): boolean {
    return this.M.enableLog != null ? this.M.enableLog : false;
  }

  get enableMulitPrint(): boolean {
    return this.M.enableMulitPrint != null ? this.M.enableMulitPrint : false;
  }

  get cls(): string {
    return 'PSDEPrintImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'app.dataentity.IPSAppDEPrint' || cls == 'app.dataentity.IPSAppDataEntityObject' || cls == 'dataentity.print.IPSDEPrint') return true;
    return super.instanceof(cls);
  }
}
